package web.exercise.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import web.exercise.Dao.ContactsDao;
import web.exercise.Dao.impl.ContactsDaoImpl;

public class DeleteServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		ContactsDao dao=new ContactsDaoImpl();
		String id=request.getParameter("id");
		dao.delete(id);
		boolean result=true;
		request.setAttribute("delResult", result);
		request.getRequestDispatcher("ShowListServlet").forward(request,response);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(req, resp);
	}
}
